package com.gzsxy.esjy.config.controller;

import com.gzsxy.esjy.config.service.ConfigManagerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author xiaolong
 * @version 1.0
 * @description: 配置中心
 * @date 2021/12/23 15:19
 */
@CrossOrigin  //解决跨域
@RestController
@RequestMapping("/config")
@Api("配置中心")
public class ConfigManagerController {

    @Autowired
    private ConfigManagerService configManagerService;

    /**
     * @description: 指定服务名刷新配置
     * @param  application 服务名  如果为global则全局刷新
     * @return
     */
    @GetMapping("/refresh")
    @ApiOperation("刷新配置文件")
    public String refresh(@RequestParam(name = "application") String application){
        configManagerService.refresh(application);
        return "刷新成功";
    }



}
